<template>
    <div class="app-container editcss">
        <screenSelect title="超时时间：" type='input' v-model="form.val" :isValue='form.val' placeholder="请输入超时时间"
            @transfer="valueHeld($event, 'val')" width='286px' position="top" :isBorder="untenFun(form.val)" />
        <div class="unten" v-if="untenFun(form.val)">请输入超时时间</div>



        <el-button type="primary" @click="save">提 交</el-button>
    </div>
</template>

<script>

import screenSelect from '@/components/screenSelect/index.vue';
import { editovertime, getovertime } from '@/api/enterpriseinfo.js'
export default {
    name: 'WorkspaceJsonOvertimes',

    components: {
        screenSelect
    },
    data() {
        return {

            form: {val:''},
            isUnten: false
        };
    },

    mounted() {
        this.getList()
    },

    methods: {
        getList() {
            let that = this
            getovertime().then(res => {
                if (res.code == 200) {
                    that.form.val = res.data.val
                    localStorage.setItem('overtime',res.data.val)
                } else {
                    that.$modal.msgError(res.message)
                }

            })
        },

        untenFun(data) {
            if (this.isUnten) {
                if (data == undefined) {
                    return true
                } else {
                    if (data == '' && data != '0') {
                        return true
                    } else {
                        return false
                    }
                }
            } else {
                return false
            }

        },
        valueHeld(childParam, fatherparam) {
            this.isUnten = false
            this.form[fatherparam] = childParam
        },
        save() {
            let that = this
            editovertime(this.form).then(res => {
                if (res.code == 200) {
                    localStorage.setItem('overtime',this.form.val)
                    that.$modal.msgSuccess(res.message)
                } else {
                    that.$modal.msgError(res.message)
                }
            })
            console.log('提交', this.form);

        }
    },
};
</script>

<style lang="scss" scoped></style>